﻿@{
    NoteAndContent noteAndContent = ViewBag.noteAndContent;
    Note note = noteAndContent.note;
    BlogInfo blogInfo = ViewBag.blogInfo;
}
<!-- 赞 -->
<div class="entry-controls clearfix">
    <div class="vote-section-wrapper clearfix">
        <button class="btn btn-default btn-zan" id="likeBtn"><i class="fa fa-thumbs-o-up"></i> <span id="likeNum">@(note.LikeNum)</span> 赞</button>
        <div class="voters clearfix" id="likers"></div>
    </div>
</div>
<script type="text/x-jsrender" id="tLikers">
    [[for users]]
    <a id="liker_[[:UserId]]" title="[[:BlogTitle]]" href="[[:BlogUrl]]" target="_blank" class="voter">
        [[if Logo]]
        <img alt="avatar" class="avatar-small" src="[[:Logo]]">
        [[else]]
        <img alt="avatar" class="avatar-small" src="/images/blog/default_avatar.png">
        [[/if]]
    </a>
    [[/for]]
</script>
@if (blogInfo.OpenComment && !blogInfo.CommentType.ToLower().Equals("disqus"))
{
    <script type="text/x-jsrender" id="tComments">
        [[for comments]]
        <li class="comment-item">
            <!-- 头像 -->
            <a ui-hovercard="" target="_blank" class="avatar-link" title="[[:UserInfo.Username]]" href="[[:UserInfo.BlogUrl]]">
                <img class="avatar" src="[[:UserInfo.Logo]]">
            </a>
            <!-- 评论 -->
            <div class="comment-body">
                <div class="comment-hd">
                    <a href="[[:UserInfo.BlogUrl]]" target="_blank" class="color-{{$.themeInfo.Color}}-{{$.themeInfo.ColorStrength}}">[[:UserInfo.Username]]</a>
                    [[if IsAuthorComment]]
                    <span>（作者）</span>
                    [[/if]]

                    <!-- 回复其它人 -->
                    [[if ToUserInfo]]
                    <span class="in-reply-to">
                        回复
                        <a href="[[:ToUserInfo.BlogUrl]]" class="color-{{$.themeInfo.Color}}-{{$.themeInfo.ColorStrength}}">[[:ToUserInfo.Username]]</a>
                    </span>
                    [[if ToUserIsAuthor]]
                    <span>（作者）</span>
                    [[/if]]
                    [[/if]]
                </div>
                <div class="comment-content ng-binding" ng-bind-html="comment.content">
                    [[html:Content]]
                </div>
                <div class="comment-ft clearfix" data-comment-id="[[:CommentId]]">
                    <span title="" ui-time="" class="date">[[:PublishDate]] </span>
                    <span class="like-num [[if !LikeNum]]hide[[/if]]" title="[[:LikeNum]] 赞"><span class="like-num-i">[[:LikeNum]]</span> 赞</span></span>

                    [[if ~root.visitUserInfo.UserId]]
                    [[if IsMyNote && !IsMyComment]]
                    <a href="javascript:;" class="comment-trash op-link "><i class="fa fa-trash"></i> 删除</a>
                    [[/if]]
                    [[if !IsMyComment]]
                    <a href="javascript:;" class="comment-reply op-link ">
                        <i class="fa fa-reply"></i>
                        回复
                    </a>
                    <a href="javascript:;" class="comment-like op-link"><i class="fa fa-thumbs-o-up"></i> <span class="like-text">[[if IsILikeIt]]取消赞[[else]]赞[[/if]]</span></a>
                    [[else]]
                    <a href="javascript:;" class="comment-trash op-link "><i class="fa fa-trash"></i> 删除</a>
                    [[/if]]
                    [[/if]]
                </div>

                <!-- 回复该评论 -->
                [[if ~root.visitUserInfo.UserId]]
                <form class="comment-form comment-box-ft">
                    <div class="clearfix">
                        <div class="avatar-wrap">
                            <img class="avatar" src="[[:~root.visitUserInfo.Logo]]">
                        </div>
                        <div class="editor-wrap">
                            <textarea class="editable" id="commentContent" name="commentContent" placeholder="回复"></textarea>
                        </div>
                    </div>

                    <div class="command clearfix" style="display: block;">
                        <button id="reply-comment-btn" class="button raised bg-{{$.themeInfo.Color}}-{{$.themeInfo.ColorStrength}}" data-comment-id="[[:CommentId]]" style="color:#fff">提交评论</button>
                        <button id="reply-cancel" class="button color-red-500">Cancel</button>
                    </div>
                </form>
                [[/if]]
            </div>
        </li>
        [[/for]]
    </script>

    <!-- 评论 -->
    <div class="comment-box hide">
        <form class="comment-form comment-box-ft hide" id="commentForm">
            <div class="clearfix">
                <div class="avatar-wrap">
                    <img class="avatar" id="visitUserLogo">
                </div>
                <div class="editor-wrap">
                    <textarea class="editable" id="commentContent" name="commentContent" placeholder="评论" style="height: 100px;"></textarea>
                </div>
            </div>
            <div class="command clearfix" style="display: block;">
                <button id="reply-comment-btn" class="button raised bg-{{$.themeInfo.Color}}-{{$.themeInfo.ColorStrength}}" style="color:#fff">提交评论</button>
            </div>
        </form>
        <div class="needLogin hide" id="noLoginContainer">
            <a onclick="goLogin()" class="color-{{$.themeInfo.Color}}-{{$.themeInfo.ColorStrength}}">立即登录</a>，发表评论
            <br />
            没有帐号？<a onclick="goRegister()" class="color-{{$.themeInfo.Color}}-{{$.themeInfo.ColorStrength}}">立即注册</a>
        </div>
        <div class="box-header">
            <span class="counter">
                <span id="commentNum">{{$.post.CommentNum}}</span> 条评论
            </span>
        </div>
        <!-- 评论列表 -->
        <ul id="comments">
        </ul>
    </div>

    <!-- 更多评论 -->
    <div id="moreComments">
        <div class="hide comments-more">
            <a>More...</a>
        </div>
        <div class="comments-loading">
            <img src="/images/loading-32.gif" />
        </div>
    </div>

}

@if (blogInfo.OpenComment && blogInfo.CommentType.ToLower().Equals("disqus"))
{

    <div id="disqus_thread"></div>
    <!-- comment -->
    <script type="text/javascript">
    /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
    var disqus_shortname = '{{.blogInfo.DisqusId}}'; // required: replace example with your forum shortname
    var disqus_identifier = '{{.blogInfo.UserId}}/{{$.post.NoteId}}/{{$.post.Title}}'; // 博客链接

    /* * * DON'T EDIT BELOW THIS LINE * * */
    (function() {
        var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
        dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    })();
    </script>
    <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
    <a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
}